import React from "react"

// 函数组件事件
function HelloFunctionComponent () {
  const clickHandle = () => {
    console.log('Click function handle.')
  }
  return <div onClick={clickHandle}>This is function component</div>
}

// 类组件事件
class HelloClassComponent extends React.Component {
  clickHandle = () => {
    console.log('Click class handle')
  }
  // 标准写法
  render () {
    return <div onClick={this.clickHandle}>This is class component</div>
  }
}

function App () {
  return (
    <div>
      <HelloFunctionComponent></HelloFunctionComponent>
      <HelloClassComponent></HelloClassComponent>
    </div>
  )
}

export default App
